home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1993, 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- /* $Revision: 1.6 $ */
- /* compile: cc -o xlayerinfo xlayerinfo.c XLayerUtil.c -lX11 */
-
- #include <stdio.h>
- #include "XLayerUtil.h"
-
- main(argc, argv)
- int argc;
- char *argv[];
- {
- Display *dpy;
- char *display_name, *arg, *class;
- XLayerVisualInfo template, *lvinfo;
- int nVisuals, i;
-
- display_name = NULL;
- for(i=1; i<argc; i++) {
- arg = argv[i];
- if(strcmp(arg, "-display") == 0 || strcmp(arg, "-d") == 0) {
- if(++i >= argc) {
- fprintf(stderr, "nmbxdemo: missing argument to -display\n");
- exit(1);
- }
- display_name = argv[i];
- }
- }
- dpy = XOpenDisplay(display_name);
- if(dpy == NULL) {
- fprintf(stderr, "xlayerinfo: cannot open display %s\n",
- XDisplayName(NULL));
- exit(1);
- }
- lvinfo = XGetLayerVisualInfo(dpy, 0L, &template, &nVisuals);
- for(i=0; i<nVisuals; i++) {
- printf(" Visual ID: 0x%x\n", lvinfo[i].vinfo.visualid);
- printf(" screen: %d\n", lvinfo[i].vinfo.screen);
- printf(" depth: %d\n", lvinfo[i].vinfo.depth);
- switch(lvinfo[i].vinfo.class) {
- case StaticGray: class = "StaticGray"; break;
- case GrayScale: class = "GrayScale"; break;
- case StaticColor: class = "StaticColor"; break;
- case PseudoColor: class = "PseudoColor"; break;
- case TrueColor: class = "TrueColor"; break;
- case DirectColor: class = "DirectColor"; break;
- default: class = "Unknown"; break;
- }
- printf(" class: %s\n", class);
- switch(lvinfo[i].type) {
- case None:
- printf(" transparent type: None\n");
- break;
- case TransparentPixel:
- printf(" transparent type: TransparentPixel\n");
- printf(" pixel value: %d\n", lvinfo[i].value);
- break;
- case TransparentMask:
- printf(" transparent type: TransparentMask\n");
- printf(" transparency mask: %0x%x\n", lvinfo[i].value);
- break;
- default:
- printf(" transparent type: Unkown or invalid\n");
- break;
- }
- printf(" layer: %d\n", lvinfo[i].layer);
- }
- }
-